package com.study.hot.rx.viewmodel

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.study.hot.model.Product

/**
 * <pre>
 *     author : fauks
 *     time   : 2020/03/28
 *     desc   :
 * </pre>
 */
class ProductViewModel : ViewModel() {

    val product: MutableLiveData<MutableList<Product>> by lazy {
        MutableLiveData<MutableList<Product>>()
    }

    /*val productSection: MutableLiveData<MutableList<ProductAdapter.ProductSection>> by lazy {
        MutableLiveData<MutableList<ProductAdapter.ProductSection>>()
    }*/

    fun getProductList() {
        val products: MutableList<Product> = mutableListOf()
        for (i in (0..6)) {
            val p = Product(name = "类目$i")
            for (j in (0..8)) {
                p.productList.add(Product("商品$j"))
            }
            products.add(p)
        }
        product.value = products
    }
}